var Sequelize = require('sequelize') // 引入sequelize 模块
var CONFIG = require('./config') //引入数据库连接配置
 
// 实例化数据库对象
var sequelize = new Sequelize(
    CONFIG.MYSQL.database,
    CONFIG.MYSQL.username,
    CONFIG.MYSQL.password, 
    {
        host: CONFIG.MYSQL.host,
        dialect: 'mysql',
        logging: CONFIG.DEBUG ? console.log : false,
        pool: {
            max: 5,
            min: 0,
            idle: 1000
        },
        timezone: '+08:00'
    }
);
module.exports = sequelize //导出 实例化 数据库对象